package com.dingdang.mapper;

import com.dingdang.model.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface UserMapper {

//  编写映射器类
// 针对此类，一般有两种实现方式来操作数据库
//1）注解：@Insert、@Select、@Update、@Delete
//2）xml文件配置

    @Select("select count(user_id) from app_admin where login_name=#{login_name} and password=#{password} ")
    int getUserByUserNameAndPassWord(User user);

    @Insert("insert  into tb_user(user_name,user_age)values (#{userName},#{userAge})")
    int addUser(User user);

    @Delete("DELETE FROM tb_user where user_id=#{userId}")
    int deleteUser(User user);

    int updateUser(User user);

    User getUserById(User user);

    List<User> selectAllUser();


}